\documentclass[cover]{gzgbook}

\ctexset{
	secnumdepth=1,
	paragraph={
		format=\color{biaoti} \fangsong \centering,
        numbering=false,
        beforeskip=0.5ex,
        afterskip=0.5ex,
        runin=false},
    }
\hypersetup{pdfauthor=周文王,pdftitle=易经,pdfsubject=易经、国学,pdfkeywords={易经,周易},pdfproducer=xelatex-texstudio,pdfcreator=Aniu}

\usepackage{lscape}
\usepackage{subfiles}
\usepackage{tikz}
%\usetikzlibrary{arrows,snakes,backgrounds}
%%说明
%%\taiji[参数]，可选参数，可以添加如xscale=-1之类的参数。
%%\yin[旋转角度]{y轴位置}，\yang[旋转角]{y轴位置}，角度不填则默认为0。
%%\xiantian，\xiantianname，先天八卦和对应的卦名，没有参数。
%%\houtian，\houtianname，后天八卦和对应的卦名，没有参数。
%%\qian[参数]，可选，若参数不为空且两卦并列时，则为上卦，如\qian[2]\kun。其他类似。
%%\guaname[arg1]{卦名}，arg1可选，默认为2，六划卦使用；若值为空则为三划卦；其他值可能会产生错位。
%%\tu[缩放]{上面所定义的路径}，缩放参数可选，另外还可以“1,xscale”的方式添加别的参数。
%%guabox环境，中间用\tcblower隔开。\yaobox{爻词}。
%%\xiang{象词}、\tuan{彖词}、\zhu{注释}，其实用的是描术列表

%太极
\newcommand{\taiji}[1][]{
	\fill[black,#1] (0,-2) arc (-90:90:2) arc (90:-90:1) arc (90:270:1) --cycle;
    \fill[white,#1] (0,2) arc (90:270:2) arc (270:90:1) arc (-90:90:1) --cycle;
    \fill[black,#1] (0,1) circle (0.25);
    \fill[white,#1] (0,-1) circle (0.25);
}
%阴阳
\definecolor{coyzh}{RGB}{192,63,60}
\newcommand{\yang}[2][0]{
    \draw[rotate=#1,coyzh]   (-1,#2)--(1,#2);
} 
\definecolor{coywl}{RGB}{0, 142, 89}
\definecolor{coyym}{RGB}{63,63,60}
\newcommand{\yin}[2][0]{
    \draw[rotate=#1,coyym]   (-1,#2)--(-0.15,#2) (0.15,#2)--(1,#2);
}
%先天八卦
\newcommand{\xiantian}{
    \yang[-90]{3}     \yin[-90]{3.5}    \yang[-90]{4}     ;
    \yang[-45]{3}    \yin[-45]{3.5}   \yin[-45]{4}     ;
    \yin[0]{3}     \yin[0]{3.5}   \yin[0]{4}     ;
    \yin[45]{3}    \yin[45]{3.5}  \yang[45]{4}   ;
    \yin[90]{3}    \yang[90]{3.5} \yin[90]{4}    ;
    \yin[135]{3}    \yang[135]{3.5} \yang[135]{4}   ;
    \yang[180]{3}   \yang[180]{3.5} \yang[180]{4}   ;
    \yang[225]{3}   \yang[225]{3.5} \yin[225]{4}    ;
}
\newcommand{\xiantianname}{
    \node at(0:4.6) {\small\kaishu 离};
    \node at(45:4.6) {\small\kaishu 震};
    \node at(90:4.6) {\small\kaishu 坤};
    \node at(135:4.6) {\small\kaishu 艮};
    \node at(180:4.6) {\small\kaishu 坎};
    \node at(225:4.6) {\small\kaishu 巽};
    \node at(270:4.6) {\small\kaishu 乾};
    \node at(315:4.6) {\small\kaishu 兑};
}
%后天八卦
\newcommand{\houtian}{
    \yang[-90]{3}\yin[-90]{3.5}\yin[-90]{4} ;
    \yin[-45]{3}\yin[-45]{3.5} \yang[-45]{4} ;
    \yin[0]{3}\yang[0]{3.5} \yin[0]{4} ;
    \yang[45]{3}\yang[45]{3.5} \yang[45]{4} ;
    \yang[90]{3}\yang[90]{3.5} \yin[90]{4} ;
    \yin[135]{3}\yin[135]{3.5} \yin[135]{4} ;
    \yang[180]{3}\yin[180]{3.5} \yang[180]{4} ;
    \yin[225]{3}\yang[225]{3.5} \yang[225]{4} ;
}
\newcommand{\houtianname}{
    \node at(0:4.6) {\small\kaishu 震};
    \node at(45:4.6) {\small\kaishu 艮};
    \node at(90:4.6) {\small\kaishu 坎};
    \node at(135:4.6) {\small\kaishu 乾};
    \node at(180:4.6) {\small\kaishu 兑};
    \node at(225:4.6) {\small\kaishu 坤};
    \node at(270:4.6) {\small\kaishu 离};
    \node at(315:4.6) {\small\kaishu 巽};
}
%十二消息卦
\newcommand{\xiaoxi}{
    \yin{5}\yang{5.5}\yang{6}\yang{6.5}\yang{7}\yang{7.5};
    \yin[330]{5}\yin[330]{5.5}\yang[330]{6}\yang[330]{6.5}\yang[330]{7}\yang[330]{7.5};
    \yin[300]{5}\yin[300]{5.5}\yin[300]{6}\yang[300]{6.5}\yang[300]{7}\yang[300]{7.5};
    \yin[270]{5}\yin[270]{5.5}\yin[270]{6}\yin[270]{6.5}\yang[270]{7}\yang[270]{7.5};
    \yin[240]{5}\yin[240]{5.5}\yin[240]{6}\yin[240]{6.5}\yin[240]{7}\yang[240]{7.5};
    \yin[210]{5}\yin[210]{5.5}\yin[210]{6}\yin[210]{6.5}\yin[210]{7}\yin[210]{7.5};
    \yang[180]{5}\yin[180]{5.5}\yin[180]{6}\yin[180]{6.5}\yin[180]{7}\yin[180]{7.5};
    \yang[150]{5}\yang[150]{5.5}\yin[150]{6}\yin[150]{6.5}\yin[150]{7}\yin[150]{7.5};
    \yang[120]{5}\yang[120]{5.5}\yang[120]{6}\yin[120]{6.5}\yin[120]{7}\yin[120]{7.5};
    \yang[90]{5}\yang[90]{5.5}\yang[90]{6}\yang[90]{6.5}\yin[90]{7}\yin[90]{7.5};
    \yang[60]{5}\yang[60]{5.5}\yang[60]{6}\yang[60]{6.5}\yang[60]{7}\yin[60]{7.5};
    \yang[30]{5}\yang[30]{5.5}\yang[30]{6}\yang[30]{6.5}\yang[30]{7}\yang[30]{7.5};}
\newcommand{\xiaoxiname}{      
    \node[above] at(90:7.5) {\small \kaishu 姤};
    \node[above,rotate=330] at(60:7.5) {\small \kaishu 遁};
    \node[above,rotate=300] at(30:7.5) {\small \kaishu 否};
    \node[above,rotate=270] at(0:7.5) {\small \kaishu 观};
    \node[above,rotate=240] at(330:7.5) {\small \kaishu 剥};
    \node[above,rotate=210] at(300:7.5) {\small \kaishu 坤};
    \node[above,rotate=180] at(270:7.5) {\small \kaishu 复};
    \node[above,rotate=150] at(240:7.5) {\small \kaishu 临};
    \node[above,rotate=120] at(210:7.5) {\small \kaishu 泰};
    \node[above,rotate=90] at(180:7.5) {\small \kaishu 大壮};
    \node[above,rotate=60] at(150:7.5) {\small \kaishu 夬};
    \node[above,rotate=30] at(120:7.5) {\small \kaishu 乾};}
\newcommand{\shichen}{    
    \node[below,rotate=180] at(270:5) {\small \kaishu 子};
    \node[below,rotate=150] at(240:5) {\small \kaishu 丑};
    \node[below,rotate=120] at(210:5) {\small \kaishu 寅};
    \node[below,rotate=90] at(180:5) {\small \kaishu 卯};
    \node[below,rotate=60] at(150:5) {\small \kaishu 辰};
    \node[below,rotate=30] at(120:5) {\small \kaishu 巳};    
    \node[below] at(90:5) {\small \kaishu 午};
    \node[below,rotate=330] at(60:5) {\small \kaishu 未};
    \node[below,rotate=300] at(30:5) {\small \kaishu 申};
    \node[below,rotate=270] at(0:5) {\small \kaishu 酉};
    \node[below,rotate=240] at(330:5) {\small \kaishu 戌};
    \node[below,rotate=210] at(300:5) {\small \kaishu 亥};}
    
%%乾卦
\newcommand{\qian}[1][]{\ifblank{#1}
    {\yang{0} \yang{0.5} \yang{1};}
    {\yang{0.75*#1} \yang{0.5+0.75*#1} \yang{1+0.75*#1};}}
%%坤卦
\newcommand{\kun}[1][]{\ifblank{#1}
    {\yin{0} \yin{0.5} \yin{1};}
    {\yin{0.75*#1} \yin{0.5+0.75*#1} \yin{1+0.75*#1};}}
%%震卦
\newcommand{\zhen}[1][]{\ifblank{#1}
    {\yang{0} \yin{0.5} \yin{1};}
    {\yang{0.75*#1} \yin{0.5+0.75*#1} \yin{1+0.75*#1};}}
%%巽卦
\newcommand{\xun}[1][]{\ifblank{#1}
    {\yin{0} \yang{0.5} \yang{1};}
    {\yin{0.75*#1} \yang{0.5+0.75*#1} \yang{1+0.75*#1};}}
%%坎卦
\newcommand{\kan}[1][]{\ifblank{#1}
    {\yin{0} \yang{0.5} \yin{1};}
    {\yin{0.75*#1} \yang{0.5+0.75*#1} \yin{1+0.75*#1};}}
%%离卦
\newcommand{\li}[1][]{\ifblank{#1}
    {\yang{0} \yin{0.5} \yang{1};}
    {\yang{0.75*#1} \yin{0.5+0.75*#1} \yang{1+0.75*#1};}}
%%艮卦
\newcommand{\gen}[1][]{\ifblank{#1}
    {\yin{0} \yin{0.5} \yang{1};}
    {\yin{0.75*#1} \yin{0.5+0.75*#1} \yang{1+0.75*#1};}}
%兑卦
\newcommand{\dui}[1][]{\ifblank{#1}
    {\yang{0} \yang{0.5} \yin{1};}
    {\yang{0.75*#1} \yang{0.5+0.75*#1} \yin{1+0.75*#1};}}
%卦名
\newcommand{\guaname}[2][2]{
    \node at(0,1.5*#1) {\small\kaishu #2};
}
%作图
\newcommand{\tu}[2][1]{
    \begin{tikzpicture}[line width=3,x=0.5,y=0.5,scale=30*#1]   
        #2
    \end{tikzpicture}
}

\renewcommand{\emph}[1]{{\heiti #1}}

%%================下面定义一些箱子================%%

\usepackage{mybox}
\usepackage{varwidth}


\newcommand{\guabox}[2]{
    \tcbsidebyside[cosry,boxsep=0pt,top=0pt,sidebyside adapt=left,sidebyside gap=3mm,lower separated=false,sidebyside align=center seam,center upper,fontlower=\zihao{5}]{#1}{#2}}
\newcommand{\yaobox}[2]{
    \tcbsidebyside[cosrr,boxsep=0pt,sidebyside adapt=left,sidebyside align=top,sidebyside gap=0.5ex,lower separated=false]{\heiti\color{coywl}#1:}{#2}}
%\usepackage{enumitem}
\usepackage{calc}
\newcommand{\zhu}[1]{\noindent \hangindent 2.8em \strong{注释：}#1\par}
\newcommand{\tuan}[1]{\noindent \hangindent 2.8em \strong{彖曰：}#1\par}
\newcommand{\xiang}[1]{\noindent \hangindent 2.8em \strong{象曰：}#1\par}


\usepackage[section]{placeins}%浮动体不要跨过 section
\usepackage[figuresleft]{rotating}%将图表转个角度
\newcommand{\yisymbol}[1]{{\CJKfontspec{DejaVu Sans}\char\numexpr"4DBF+#1}}%64卦unicode符号
\newcommand{\basymbol}[1]{{\fontspec{DejaVu Sans}\char\numexpr"2630+#1}}%太极两仪四象八卦unicode符号
\newcommand{\czjh}[6]{\tcbox[cosgo,tikznode]{\textcolor{cogreen}{#1}卦的错卦为\hyperref[#2]{#2}卦，综卦为\hyperref[#3]{#3}卦，\\交卦为\hyperref[#4]{#4}卦，互卦为\hyperref[#5]{#5}卦和\hyperref[#6]{#6}卦。}}
%\hypersetup{bookmarksopenlevel=1}
\fancypagestyle{yifancy}{%
    \fancyhf{}
    \lhead{\itshape\scriptsize{\kaishu\rightmark}}
    \chead{\scriptsize\hyperref[速查表]{\basymbol{-1}}}
    \rhead{\scriptsize{\thepage/\pageref*{LastPage}}}
    \renewcommand{\headrulewidth}{0pt}
}
\usepackage[bottom]{footmisc}
\usepackage{tabularray}
\UseTblrLibrary{diagbox}
\usepackage{mysixfour}

\renewcommand{\normalsize}{\zihao{-4}}
%\usepackage{multirow}


%\usepackage[style=]{biblatex}
\usepackage{gbt7714}
\bibliographystyle{gbt7714-numerical}
%%=======================
\title{易经}
\author{Aniu整理制作}
\date{\today}
%%=======================
\begin{document}
    \sloppy
%    \pdfbookmark[1]{封面}{page:cover}
    \addcontentsline{toc}{chapter}{封面}
    \maketitle
    
    \pdfbookmark[0]{目录}{page:content}
    \tableofcontents    \label{mulu}
    
    \pagestyle{yifancy}

    \subfile{易经知识}
    \subfile{六十四卦}
    \subfile{系辞}
    \subfile{说卦传}
    \subfile{序卦传}
    \subfile{杂卦传}
    
    \backmatter
    \pdfbookmark[0]{参考文献}{cha:ref}
    \nocite{mhj2001}
    \nocite{fpr2007}
    \nocite{zsq2010}
    \bibliography{$HOME/.texlive/texmf/tex/latex/mybib.bib}
    
\end{document}
